package spring.core.aop.pointcut;

import java.lang.reflect.Method;
import java.util.Objects;

import org.springframework.aop.support.StaticMethodMatcherPointcut;

/**
 * @author 1203056
 * @version Id: TeacherServicePointcut.java, v 0.1 2021-09-06 23:59 1203056 Exp $
 */
public class TeacherServicePointcut extends StaticMethodMatcherPointcut {
    private String   method;
    private Class<?> target;

    public TeacherServicePointcut(String method, Class<?> target) {
        this.method = method;
        this.target = target;
    }

    @Override
    public boolean matches(Method method, Class<?> targetClass) {
        return Objects.equals(method.getName(), this.method) && target.isAssignableFrom(targetClass);
    }
}
